// 加载操作列表
let UPDATE_OPERATION = (state, playload) => {
    // 要浅拷贝一下，防止出现其他问题
    state.operation = [...playload];
}

// 添加操作
let ADD_OPERATION = (state, operation) => {
    state.operation.push(operation);
}

// 编辑操作
let EDIT_OPERATION = (state, payload) => {
    let index = state.operation.findIndex(operation => operation.operation_id === payload.operation_id);
    if (index !== -1) {
        // 使用 splice 方法更新数组，以便触发响应式更新机制
        state.operation.splice(index, 1, payload);
    }
}

// 删除操作
let REMOVE_OPERATION = (state, index) => {
    state.operation.splice(index, 1);
}
export default {
    UPDATE_OPERATION,
    ADD_OPERATION,
    EDIT_OPERATION,
    REMOVE_OPERATION,
}